LassoScript Utility
Basics Browse Detail

[File->Read]

Tag Link [File->Read] Category File
Type Member Source Available Yes
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type Bytes Security File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Description

Reads data from a file. Requires the interger number of bytes to read as a parameter. Outputs the file data as bytes.

Syntax

[File Variable->(Read: 256)]

Parameters

Required Parameters
Integer The integer number of bytes (characters) to read as a parameter.

Examples

To read characters from a file:

Use the [File->Read] tag. The file object should be cast with an open mode that permits reading, and with the read mode set to File_ModeChar. The example below reads the first 256 characters of myfile.txt.

[Var:'File'=(File: 'myfile.txt', File_OpenRead, File_ModeChar)]
[$File->(Read: 256)]
[$File->Close]

To read lines from a file:

Use the [File->Read] tag. The file object should be cast with an open mode that permits reading, and with the read mode set to File_ModeLine. The example below reads the first 4 lines of myfile.txt.

[Var:'File'=(File: 'myfile.txt', File_OpenRead, File_ModeLine)]
[$File->(Read: 4)]
[$File->Close]